class Solution(object):
    def oddCells(self, m, n, indices):
        """
        :type m: int
        :type n: int
        :type indices: List[List[int]]
        :rtype: int
        """
        h = [0] * m
        v = [0] * n
        for c in indices:
            h[c[0]] = (h[c[0]] + 1) % 2
            v[c[1]] = (v[c[1]] + 1) % 2
        t = sum(v)
        total = 0
        for i in range(m):
            if h[i]:
                total += n - t
            else:
                total += t
        return total